Skip to content

Conversation

max-scopp
Copy link
Contributor

@max-scopp max-scopp commented Aug 11, 2025

Builds on top of #2422

- Updated `openapi-ts.config.ts` to configure Angular client plugin with error handling option.
- Modified `app.component.html` to use a demo component for displaying pet information.
- Refactored `app.component.ts` to remove direct API calls and integrate with the new demo component.
- Enhanced `app.config.ts` to provide the Hey API client for dependency injection.
- Improved error handling in client utilities and response processing.
- Added new demo component with HTML and CSS for displaying pet information and error messages.
- Updated client generation scripts to support new error handling and response structures.
- Refactored HTTP client usage to support custom injectors and improved error response handling.
…ration

- Introduced `types.gen.ts` for TypeScript types related to API requests and responses.
- Created `sdk.gen.ts` to define SDK functions for interacting with the API.
- Added `schemas.gen.ts` to define data schemas for various entities like Order, User, Pet, etc.
- Implemented `index.ts` to export SDK and types for easier access.
- Developed `main.ts` and `main.server.ts` for bootstrapping the Angular application.
- Set up server-side rendering with Express in `server.ts`.
- Included basic HTML structure in `index.html`.
- Configured TypeScript settings in `tsconfig` files for application and testing.
- Added global styles in `styles.css`.
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Aug 11, 2025

🦋 Changeset detected

Latest commit: 554e9a6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Aug 11, 2025

@max-scopp is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. feature 🚀 New feature or request labels Aug 11, 2025
@max-scopp max-scopp mentioned this pull request Aug 11, 2025
Copy link

codecov bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 11.24567% with 513 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.59%. Comparing base (78c9caf) to head (554e9a6).

Files with missing lines Patch % Lines
...nions/angularHttpRequestsCompanionPluginHandler.ts 4.62% 309 Missing ⚠️
...nions/angularHttpResourceCompanionPluginHandler.ts 8.42% 87 Missing ⚠️
...c/plugins/@hey-api/client-angular/bundle/client.ts 5.79% 65 Missing ⚠️
...s/openapi-ts/src/plugins/@angular/common/config.ts 28.20% 28 Missing ⚠️
...rc/plugins/@hey-api/client-angular/bundle/utils.ts 60.60% 13 Missing ⚠️
...s/openapi-ts/src/plugins/@angular/common/plugin.ts 37.50% 5 Missing ⚠️
...ages/openapi-ts/src/plugins/@hey-api/sdk/config.ts 16.66% 5 Missing ⚠️
...ages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2423      +/-   ##
==========================================
- Coverage   22.84%   22.59%   -0.25%     
==========================================
  Files         334      336       +2     
  Lines       32948    33366     +418     
  Branches     1309     1309              
==========================================
+ Hits         7526     7540      +14     
- Misses      25413    25817     +404     
  Partials        9        9              
Flag Coverage Δ
unittests 22.59% <11.24%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

pkg-pr-new bot commented Aug 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2423
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2423
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2423

commit: 554e9a6

max-scopp and others added 5 commits August 11, 2025 21:46
- Added `httpResource` and `httpRequest` companion plugin handlers to generate Angular services and functions for API operations.
- Introduced `PetResources`, `StoreResources`, and `UserResources` classes for managing pet store operations.
- Enhanced configuration options for HTTP resources and requests, allowing customization of class and method names.
- Generated TypeScript definitions for Angular HTTP resource and request options.
- Updated plugin handler to conditionally enable HTTP resource generation based on configuration.
Copy link

vercel bot commented Aug 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
hey-api-docs Ready Preview Comment Aug 14, 2025 11:09am

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 14, 2025
Comment on lines +87 to +92
// Set default classNameBuilder based on client type
if (plugin.config.classNameBuilder === '{{name}}') {
if (plugin.config.client === '@hey-api/client-angular') {
plugin.config.classNameBuilder = '{{name}}Service';
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

@max-scopp max-scopp Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't have a custom class name builder and you use the angular client and want to create classes with asClass: true, suffix the classes with "Service" to avoid potential clashing names of the same interface and controller/class name. I did this because in the Pet store, this would result in the class and endpoints for Pet, as well, as the interface for one Pet's response

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might need to come back to this one at some point. It feels dirty. I have no problem with accepting it for now but maybe we want to add some comments around why it's done that way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'm also conflicted about this, for now the Service suffix is still widely accepted by Angular devs, but they too would prefer to move away from this pattern

@dosubot dosubot bot removed the lgtm This PR has been approved by a maintainer label Aug 14, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself: update this later

mrlubos
mrlubos previously approved these changes Aug 14, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 14, 2025
@mrlubos mrlubos merged commit 937a874 into hey-api:main Aug 14, 2025
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 New feature or request lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants